<?php

namespace app\common\model;

use think\Model;
class InquiryForm extends Model
{
    protected $resultSetType = 'collection';
    // 定义时间戳字段名
    protected $createTime = 'add_time';
    public static function inquiry_form_info($group_id)
    {
        $where = "group_id = {$group_id}";
        $field = "id,title,content,images";
        $info = self::where($where)->field($field)->find();
        if($info){
            $group_user_id = ChatGroup::where("id",$group_id)->value("user_id");
            $info['group_user_id'] = $group_user_id;
        }else{
            $info['group_user_id'] = '';
        }
        return $info;
    }

    public function getImagesAttr($value)
    {
        if($value){
            $images_arr = explode(',',$value);
            foreach ($images_arr as $key=>&$value){
                $value = splicing_domain($value);
            }
            return $images_arr;
        }else{
            return [];
        }
    }
}
